#define _CRT_SECURE_NO_WARNINGS  1
#pragma warning(disable:6031)
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;

void dif(int x, int y) {
	f[x] = 1, m[x] = 0;
	for (const auto& z : g[x]) {
		if (z == y) continue;
		dif(z, x);
		f[x] += f[z];
		m[x] = max(m[x], f[x]);
	}
	m[x] = max(m[x], n - f[x]);
	if (m[x] <= n / 2) v.push_back(x);
}